<template>
  <div class="app-container">
    <el-steps :active="currentStep" finish-status="success" style="width:70%">
      <el-step title="基础信息" description="这是一段很长很长很长的描述性文字" />
      <el-step title="站点信息" description="这是一段很长很长很长的描述性文字" />
    </el-steps>
    <div v-if="currentStep==0" style="display:flex;margin-left: 30%;margin-top:50px">
      <div style="">
        <el-form ref="form" :model="form" label-width="80px">
          <el-form-item label="活动名称">
            <el-col :span="16">
              <el-input v-model="form.name" />
            </el-col>
          </el-form-item>
          <el-form-item label="活动区域">
            <el-select v-model="form.region" placeholder="请选择活动区域">
              <el-option label="区域一" value="shanghai" />
              <el-option label="区域二" value="beijing" />
            </el-select>
          </el-form-item>
          <el-form-item label="活动时间">
            <el-col :span="8">
              <el-date-picker v-model="form.date1" type="date" placeholder="选择日期" style="width: 100%;" />
            </el-col>
            <el-col class="line" :span="2">-</el-col>
            <el-col :span="8">
              <el-time-picker v-model="form.date2" placeholder="选择时间" style="width: 100%;" />
            </el-col>
          </el-form-item>
          <el-form-item label="即时配送">
            <el-switch v-model="form.delivery" />
          </el-form-item>
          <el-form-item label="活动性质">
            <el-checkbox-group v-model="form.type">
              <el-checkbox label="美食/餐厅线上活动" name="type" />
              <el-checkbox label="地推活动" name="type" />
            </el-checkbox-group>
          </el-form-item>
          <el-form-item label="特殊资源">
            <el-radio-group v-model="form.resource">
              <el-radio label="线上品牌商赞助" />
              <el-radio label="线下场地免费" />
            </el-radio-group>
          </el-form-item>
        </el-form>
        <el-button style="margin-top: 12px;" @click="next">下一步</el-button>
      </div>
    </div>

    <div v-show="currentStep==1">
      <div style="">

        <div id="container" style="height:500px" tabindex="0" />

      </div>
    </div>

  </div>
</template>

<script>

export default {
  data() {
    return {
      currentStep: 0,
      form: {
        name: '',
        region: '',
        date1: '',
        date2: '',
        delivery: false,
        type: [],
        resource: '',
        desc: ''
      }
    }
  },
  mounted() {
    this.initData()
  },
  methods: {
    initData() {
      window.map = new AMap.Map('container', {
        resizeEnable: true,
        center: [116.397428, 39.90923],
        zoom: 13
      })
    },

    next() {
      if (this.currentStep++ > 1) this.currentStep = 0
    }
  }
}
</script>

<style scoped>
.line{
  text-align: center;
}
.app-container{
  background: #fff;
  margin: 20px;
}
</style>

